package com.itheima.dubbo.service;

import org.apache.dubbo.config.annotation.DubboService;
import org.apache.dubbo.config.annotation.Method;
import org.apache.dubbo.rpc.RpcContext;

@DubboService(timeout = 2000,retries = 0,methods ={
        @Method(name="hello")
})
public class UserServiceImpl implements com.itheima.dubbo.UserInterface {


    @Override
    public String hello(String username) {
//        try {
//            Thread.sleep(3000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
        String jwt = RpcContext.getContext().getAttachment("jwt");
        System.out.println("UserServiceImpl"+"jwt:"+jwt);
        return "hello Dubbo username:"+username;

    }
}
